{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6024dced",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"_ansible_facts_gathered\": true,\n",
      "    \"ansible_all_ipv4_addresses\": [\n",
      "        \"192.168.1.29\"\n",
      "    ],\n",
      "    \"ansible_all_ipv6_addresses\": [\n",
      "        \"fe80::1c00:87ff:fe1a:d74a%anpi1\",\n",
      "        \"fe80::1c00:87ff:fe1a:d749%anpi0\",\n",
      "        \"fe80::1896:c285:2a5e:9dba%en0\",\n",
      "        \"2409:8a1e:5c1f:28d0:1470:d1fe:c55f:d606\",\n",
      "        \"2409:8a1e:5c1f:28d0:597b:c3c9:df38:189f\",\n",
      "        \"fe80::1c45:4fff:fe76:2feb%awdl0\",\n",
      "        \"fe80::1c45:4fff:fe76:2feb%llw0\",\n",
      "        \"fe80::228b:3ec6:9285:372%utun0\",\n",
      "        \"fe80::be5a:4e3:264:73e7%utun1\"\n",
      "    ],\n",
      "    \"ansible_anpi0\": {\n",
      "        \"device\": \"anpi0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::1c00:87ff:fe1a:d749%anpi0\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0x5\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"1e:00:87:1a:d7:49\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"none\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_anpi1\": {\n",
      "        \"device\": \"anpi1\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::1c00:87ff:fe1a:d74a%anpi1\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0x4\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"1e:00:87:1a:d7:4a\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"none\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_ap1\": {\n",
      "        \"device\": \"ap1\",\n",
      "        \"flags\": [\n",
      "            \"BROADCAST\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"b2:be:83:0d:70:ee\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"CHANNEL_IO\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_apparmor\": {\n",
      "        \"status\": \"disabled\"\n",
      "    },\n",
      "    \"ansible_architecture\": \"arm64\",\n",
      "    \"ansible_awdl0\": {\n",
      "        \"device\": \"awdl0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"RUNNING\",\n",
      "            \"PROMISC\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::1c45:4fff:fe76:2feb%awdl0\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0xd\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"1e:45:4f:76:2f:eb\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"active\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_bridge0\": {\n",
      "        \"device\": \"bridge0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"36:ba:e5:e9:87:80\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"Unknown\",\n",
      "        \"media_type\": \"unknown type\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_date_time\": {\n",
      "        \"date\": \"2022-01-16\",\n",
      "        \"day\": \"16\",\n",
      "        \"epoch\": \"1642323959\",\n",
      "        \"hour\": \"17\",\n",
      "        \"iso8601\": \"2022-01-16T09:05:59Z\",\n",
      "        \"iso8601_basic\": \"20220116T170559369663\",\n",
      "        \"iso8601_basic_short\": \"20220116T170559\",\n",
      "        \"iso8601_micro\": \"2022-01-16T09:05:59.369663Z\",\n",
      "        \"minute\": \"05\",\n",
      "        \"month\": \"01\",\n",
      "        \"second\": \"59\",\n",
      "        \"time\": \"17:05:59\",\n",
      "        \"tz\": \"CST\",\n",
      "        \"tz_offset\": \"+0800\",\n",
      "        \"weekday\": \"\\u661f\\u671f\\u65e5\",\n",
      "        \"weekday_number\": \"0\",\n",
      "        \"weeknumber\": \"02\",\n",
      "        \"year\": \"2022\"\n",
      "    },\n",
      "    \"ansible_default_ipv4\": {\n",
      "        \"address\": \"192.168.1.29\",\n",
      "        \"broadcast\": \"192.168.1.255\",\n",
      "        \"device\": \"en0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"gateway\": \"192.168.1.1\",\n",
      "        \"interface\": \"en0\",\n",
      "        \"macaddress\": \"b0:be:83:0d:70:ee\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"netmask\": \"255.255.255.0\",\n",
      "        \"network\": \"192.168.1.0\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"active\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_default_ipv6\": {\n",
      "        \"address\": \"fe80::1896:c285:2a5e:9dba%en0\",\n",
      "        \"device\": \"en0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"gateway\": \"fe80::1%en0\",\n",
      "        \"interface\": \"en0\",\n",
      "        \"macaddress\": \"b0:be:83:0d:70:ee\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"prefix\": \"64\",\n",
      "        \"status\": \"active\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_distribution\": \"MacOSX\",\n",
      "    \"ansible_distribution_major_version\": \"11\",\n",
      "    \"ansible_distribution_release\": \"20.6.0\",\n",
      "    \"ansible_distribution_version\": \"11.6\",\n",
      "    \"ansible_dns\": {\n",
      "        \"nameservers\": [\n",
      "            \"fe80::1\",\n",
      "            \"192.168.1.1\"\n",
      "        ]\n",
      "    },\n",
      "    \"ansible_domain\": \"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa\",\n",
      "    \"ansible_effective_group_id\": 20,\n",
      "    \"ansible_effective_user_id\": 501,\n",
      "    \"ansible_en0\": {\n",
      "        \"device\": \"en0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [\n",
      "            {\n",
      "                \"address\": \"192.168.1.29\",\n",
      "                \"broadcast\": \"192.168.1.255\",\n",
      "                \"netmask\": \"255.255.255.0\",\n",
      "                \"network\": \"192.168.1.0\"\n",
      "            }\n",
      "        ],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::1896:c285:2a5e:9dba%en0\",\n",
      "                \"prefix\": \"64\"\n",
      "            },\n",
      "            {\n",
      "                \"address\": \"2409:8a1e:5c1f:28d0:1470:d1fe:c55f:d606\",\n",
      "                \"prefix\": \"64\"\n",
      "            },\n",
      "            {\n",
      "                \"address\": \"2409:8a1e:5c1f:28d0:597b:c3c9:df38:189f\",\n",
      "                \"prefix\": \"64\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"b0:be:83:0d:70:ee\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"active\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_en1\": {\n",
      "        \"device\": \"en1\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"PROMISC\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"36:ba:e5:e9:87:80\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"media_type\": \"full-duplex\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"TSO4\",\n",
      "            \"TSO6\",\n",
      "            \"CHANNEL_IO\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_en2\": {\n",
      "        \"device\": \"en2\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"PROMISC\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"36:ba:e5:e9:87:84\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"media_type\": \"full-duplex\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"TSO4\",\n",
      "            \"TSO6\",\n",
      "            \"CHANNEL_IO\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_en3\": {\n",
      "        \"device\": \"en3\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"1e:00:87:1a:d7:29\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"none\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_en4\": {\n",
      "        \"device\": \"en4\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"1e:00:87:1a:d7:2a\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"none\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"inactive\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_env\": {\n",
      "        \"ANSIBLE_CACHE_PLUGIN\": \"redis\",\n",
      "        \"ANSIBLE_CACHE_PLUGIN_CONNECTION\": \"localhost:6379:0\",\n",
      "        \"ANSIBLE_CACHE_PLUGIN_PREFIX\": \"ansible_facts_\",\n",
      "        \"ANSIBLE_CACHE_PLUGIN_TIMEOUT\": \"3600\",\n",
      "        \"ANSIBLE_INVENTORY_CACHE\": \"True\",\n",
      "        \"CLICOLOR\": \"1\",\n",
      "        \"CPPFLAGS\": \"-I/opt/homebrew/opt/llvm/include\",\n",
      "        \"GREP_OPTIONS\": \"--color=auto\",\n",
      "        \"HOME\": \"/Users/hbu\",\n",
      "        \"HOMEBREW_BOTTLE_DOMAIN\": \"https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles\",\n",
      "        \"HOMEBREW_CELLAR\": \"/opt/homebrew/Cellar\",\n",
      "        \"HOMEBREW_PREFIX\": \"/opt/homebrew\",\n",
      "        \"HOMEBREW_REPOSITORY\": \"/opt/homebrew\",\n",
      "        \"INFOPATH\": \"/opt/homebrew/share/info:\",\n",
      "        \"LANG\": \"zh_CN.UTF-8\",\n",
      "        \"LDFLAGS\": \"-L/opt/homebrew/opt/llvm/lib\",\n",
      "        \"LOGNAME\": \"hbu\",\n",
      "        \"LSCOLORS\": \"Exfxcxdxbxegedabagacad\",\n",
      "        \"LaunchInstanceID\": \"C1C1F269-CC1C-4DC3-900A-9383147E805B\",\n",
      "        \"MANPATH\": \"/opt/homebrew/share/man::\",\n",
      "        \"PATH\": \"/opt/homebrew/opt/postgresql@12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/homebrew/Cellar/openjdk/17.0.1_1/bin:/usr/local/mysql/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/opt/homebrew/opt/llvm/bin:/opt/elasticsearch/bin:/Users/hbu/Library/Python/3.8/bin\",\n",
      "        \"PWD\": \"/Users/hbu\",\n",
      "        \"SECURITYSESSIONID\": \"186a5\",\n",
      "        \"SHELL\": \"/bin/zsh\",\n",
      "        \"SHLVL\": \"3\",\n",
      "        \"SSH_AUTH_SOCK\": \"/private/tmp/com.apple.launchd.W5d1gVgFaO/Listeners\",\n",
      "        \"TERM\": \"xterm-256color\",\n",
      "        \"TERM_PROGRAM\": \"Apple_Terminal\",\n",
      "        \"TERM_PROGRAM_VERSION\": \"440\",\n",
      "        \"TERM_SESSION_ID\": \"AF981958-779E-486A-A540-1658BDA45123\",\n",
      "        \"TMPDIR\": \"/var/folders/mh/l6_b7c0x7m3bq41r5m25snqc0000gn/T/\",\n",
      "        \"USER\": \"hbu\",\n",
      "        \"XPC_FLAGS\": \"0x0\",\n",
      "        \"XPC_SERVICE_NAME\": \"0\",\n",
      "        \"_\": \"/Library/Developer/CommandLineTools/usr/bin/python3\",\n",
      "        \"__CFBundleIdentifier\": \"com.apple.Terminal\",\n",
      "        \"__CF_USER_TEXT_ENCODING\": \"0x1F5:0x19:0x34\"\n",
      "    },\n",
      "    \"ansible_fibre_channel_wwn\": [],\n",
      "    \"ansible_fips\": false,\n",
      "    \"ansible_fqdn\": \"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa\",\n",
      "    \"ansible_gif0\": {\n",
      "        \"device\": \"gif0\",\n",
      "        \"flags\": [\n",
      "            \"POINTOPOINT\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"unknown\",\n",
      "        \"mtu\": \"1280\",\n",
      "        \"type\": \"unknown\"\n",
      "    },\n",
      "    \"ansible_hostname\": \"Pauls-MacBook-Air\",\n",
      "    \"ansible_hostnqn\": \"\",\n",
      "    \"ansible_interfaces\": [\n",
      "        \"anpi0\",\n",
      "        \"anpi1\",\n",
      "        \"ap1\",\n",
      "        \"awdl0\",\n",
      "        \"bridge0\",\n",
      "        \"en0\",\n",
      "        \"en1\",\n",
      "        \"en2\",\n",
      "        \"en3\",\n",
      "        \"en4\",\n",
      "        \"gif0\",\n",
      "        \"llw0\",\n",
      "        \"lo0\",\n",
      "        \"stf0\",\n",
      "        \"utun0\",\n",
      "        \"utun1\"\n",
      "    ],\n",
      "    \"ansible_is_chroot\": false,\n",
      "    \"ansible_iscsi_iqn\": \"\",\n",
      "    \"ansible_kernel\": \"20.6.0\",\n",
      "    \"ansible_kernel_version\": \"Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101\",\n",
      "    \"ansible_llw0\": {\n",
      "        \"device\": \"llw0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"BROADCAST\",\n",
      "            \"SMART\",\n",
      "            \"RUNNING\",\n",
      "            \"SIMPLEX\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::1c45:4fff:fe76:2feb%llw0\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0xe\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"1e:45:4f:76:2f:eb\",\n",
      "        \"media\": \"Unknown\",\n",
      "        \"media_select\": \"autoselect\",\n",
      "        \"mtu\": \"1500\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"status\": \"active\",\n",
      "        \"type\": \"ether\"\n",
      "    },\n",
      "    \"ansible_lo0\": {\n",
      "        \"device\": \"lo0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"LOOPBACK\",\n",
      "            \"RUNNING\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [\n",
      "            {\n",
      "                \"address\": \"127.0.0.1\",\n",
      "                \"broadcast\": \"127.255.255.255\",\n",
      "                \"netmask\": \"255.0.0.0\",\n",
      "                \"network\": \"127.0.0.0\"\n",
      "            }\n",
      "        ],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"::1\",\n",
      "                \"prefix\": \"128\"\n",
      "            },\n",
      "            {\n",
      "                \"address\": \"fe80::1%lo0\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0x1\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"unknown\",\n",
      "        \"mtu\": \"16384\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"type\": \"loopback\"\n",
      "    },\n",
      "    \"ansible_local\": {},\n",
      "    \"ansible_lsb\": {},\n",
      "    \"ansible_machine\": \"arm64\",\n",
      "    \"ansible_memfree_mb\": 7037,\n",
      "    \"ansible_memtotal_mb\": 8192,\n",
      "    \"ansible_model\": \"MacBookAir10,1\",\n",
      "    \"ansible_nodename\": \"Pauls-MacBook-Air.local\",\n",
      "    \"ansible_os_family\": \"Darwin\",\n",
      "    \"ansible_osrevision\": \"199506\",\n",
      "    \"ansible_osversion\": \"20G165\",\n",
      "    \"ansible_pkg_mgr\": \"unknown\",\n",
      "    \"ansible_processor\": \"Apple M1\",\n",
      "    \"ansible_processor_cores\": \"8\",\n",
      "    \"ansible_processor_vcpus\": \"8\",\n",
      "    \"ansible_product_name\": \"MacBookAir10,1\",\n",
      "    \"ansible_python\": {\n",
      "        \"executable\": \"/Library/Developer/CommandLineTools/usr/bin/python3\",\n",
      "        \"has_sslcontext\": true,\n",
      "        \"type\": \"cpython\",\n",
      "        \"version\": {\n",
      "            \"major\": 3,\n",
      "            \"micro\": 9,\n",
      "            \"minor\": 8,\n",
      "            \"releaselevel\": \"final\",\n",
      "            \"serial\": 0\n",
      "        },\n",
      "        \"version_info\": [\n",
      "            3,\n",
      "            8,\n",
      "            9,\n",
      "            \"final\",\n",
      "            0\n",
      "        ]\n",
      "    },\n",
      "    \"ansible_python_version\": \"3.8.9\",\n",
      "    \"ansible_real_group_id\": 20,\n",
      "    \"ansible_real_user_id\": 501,\n",
      "    \"ansible_selinux\": {\n",
      "        \"status\": \"Missing selinux Python library\"\n",
      "    },\n",
      "    \"ansible_selinux_python_present\": false,\n",
      "    \"ansible_service_mgr\": \"launchd\",\n",
      "    \"ansible_ssh_host_key_dsa_public\": \"AAAAB3NzaC1kc3MAAACBAITBJpxs1QpaTCtD1UakgWr2nFgityqkj4V0m1K64KYKhkC6mWLyE21bRb7re0udPuLUyUCwFzRiHxvKNiFbbg8LDukEksAp1Tvt51e8E/2+N4OOYdRLix4z5mEHqRipj3MvFqA/IOiF8NTUl/CRa6o1gmGkmt3hufJhFA4Bts4hAAAAFQDq6srtdggCEYwbKb71srsDoiPjJQAAAIAyomANmHW9haOqgpa6dRTW9uOxrlDG9ZrhjTnwfOqEwDEFausGvZIp1SOQs5j9XC2O+Hk0LAUVvlyGf4LDH29gVjzMNLP6dWMd9AvSNpQm0SqI6iN3023d+4jDlmK8yurTWSQi21KSz9nFRmq67zHnMfA9KkOB4Bq3tawtCbgdZwAAAIAvJLLq4I0Khv21GZ8iKdEoHIR/MjUSvQIV3YS2m4xOCIhCYzQpLT7cT3aJ6+YIajrjIO2xfWPunBHzzgwliCEyzV2dGcxGDfGIDVQLTleGtIo11iGNSnYG1O/aM4bHauBiovK0Bjn7rwaZ52lf3MMlJEZNFM6+p/KbMWGqeziHxg==\",\n",
      "    \"ansible_ssh_host_key_ecdsa_public\": \"AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHICsI51SRNPx4/A7TBa0F49TaAfsTgU+OwREW60liu8Dxzwx/a33Ri6kOMA8Q09N5YpF3IIPvUdWdS0zwPdcqY=\",\n",
      "    \"ansible_ssh_host_key_ed25519_public\": \"AAAAC3NzaC1lZDI1NTE5AAAAIEXuX2uM/tJLePOvUiMAyCW7qtcwY01jJxijWo+GjGiM\",\n",
      "    \"ansible_ssh_host_key_rsa_public\": \"AAAAB3NzaC1yc2EAAAADAQABAAABgQDLubohIP2TWlA26JDnZiUTHLzVBNskGbjx0IOViWwog5g5zuKWfCibaCyFfLpS5eDuJhiiu1gSxzfjeACgt1pB20nvdzWnMVNEj2l5PUgh9fyxTqe55vgFJRt1wnra6kHgjYb+cIlvH/hi9AVThjgF/m8PiMav5TuFxPGY02xI/ACDsIxRKx6IWwbLfp3BxTF+AdhpDyhJRElO/+XhcpSn1R1SjZCpGYfgRLIwC/HIbrzOFDfkFjxev8ixMRBe9qflgH5uNdJnmghrEcZ+XP3Yv/2wtp4M+Vl+Q5qUNp8KgitBcr6d2Iq+V+ODU7z1/9BRJruYTKBJzM1KdsZAxbsPMb6xHKh0/sFuttHGOsDdAamBxHFKKnHoBvPkyN0seB1RJFxIzSMGWL35rNlqz9dIzqNl6k8HN5Me6rPnVkLj0V7KLO6Svpdf0BsLwSG6URrqWd3nHKbjxBH+/eluZGLTkKaApUuJ2uw0n7VYw6bNE0+opNtvsyYqz4ZwP+CeZlM=\",\n",
      "    \"ansible_stf0\": {\n",
      "        \"device\": \"stf0\",\n",
      "        \"flags\": [],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [],\n",
      "        \"macaddress\": \"unknown\",\n",
      "        \"mtu\": \"1280\",\n",
      "        \"type\": \"unknown\"\n",
      "    },\n",
      "    \"ansible_system\": \"Darwin\",\n",
      "    \"ansible_user_dir\": \"/Users/hbu\",\n",
      "    \"ansible_user_gecos\": \"hbu\",\n",
      "    \"ansible_user_gid\": 20,\n",
      "    \"ansible_user_id\": \"hbu\",\n",
      "    \"ansible_user_shell\": \"/bin/zsh\",\n",
      "    \"ansible_user_uid\": 501,\n",
      "    \"ansible_userspace_bits\": \"64\",\n",
      "    \"ansible_utun0\": {\n",
      "        \"device\": \"utun0\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"POINTOPOINT\",\n",
      "            \"RUNNING\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::228b:3ec6:9285:372%utun0\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0xf\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"unknown\",\n",
      "        \"mtu\": \"1380\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"type\": \"unknown\"\n",
      "    },\n",
      "    \"ansible_utun1\": {\n",
      "        \"device\": \"utun1\",\n",
      "        \"flags\": [\n",
      "            \"UP\",\n",
      "            \"POINTOPOINT\",\n",
      "            \"RUNNING\",\n",
      "            \"MULTICAST\"\n",
      "        ],\n",
      "        \"ipv4\": [],\n",
      "        \"ipv6\": [\n",
      "            {\n",
      "                \"address\": \"fe80::be5a:4e3:264:73e7%utun1\",\n",
      "                \"prefix\": \"64\",\n",
      "                \"scope\": \"0x10\"\n",
      "            }\n",
      "        ],\n",
      "        \"macaddress\": \"unknown\",\n",
      "        \"mtu\": \"2000\",\n",
      "        \"options\": [\n",
      "            \"PERFORMNUD\",\n",
      "            \"DAD\"\n",
      "        ],\n",
      "        \"type\": \"unknown\"\n",
      "    },\n",
      "    \"ansible_virtualization_role\": \"\",\n",
      "    \"ansible_virtualization_type\": \"\",\n",
      "    \"gather_subset\": [\n",
      "        \"all\"\n",
      "    ],\n",
      "    \"module_setup\": true\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "#ansible redis 缓存\n",
    "import redis\n",
    "import json\n",
    "fact_caching_prefix =\"ansible_facts_\"\n",
    "r = redis.StrictRedis(host='localhost', port=6379, db=0)\n",
    "host='127.0.0.1'\n",
    "data=r.get(fact_caching_prefix+host)\n",
    "obj=json.loads(data)\n",
    "#obj.values()\n",
    "print(json.dumps(obj, indent=4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "10d30b21",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "26e88cfc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
